import os
from conffile import Config

max_time = '3600'  # in seconds
TEMP = os.getenv('TEMP')
TMP = os.getenv('TMP')

parent_dir = os.path.join(str(__file__).split('system')[0], 'system')
this_temp = os.path.join(parent_dir,'temp')
os.environ.update({'ETIK_CONF':os.path.dirname(__file__)})
f = os.path.join(os.environ.get('ETIK_CONF'), 'conf.ini')
cfg = Config(f)

#parent_dir_pre = str(__file__).split('system')[0]
#print this_temp

def testme():
    print "heloo .... "          
    print "cfg.message = ", cfg.setting

def write_config(data_001, state):
    if data_001 == 'Yes':
        data_02 = 1
    elif data_001 == 'No':
        data_02 = 0
    else:
        data_02 = 0
    out = file(f,'w')
    cfg.setting[0].show_error_log_detail = state
    cfg.setting[0].log_to_file = data_02
    cfg.save(out)
    out.close()
    
def read_config():
    #print cfg.setting[0].show_error_log_detail
    return cfg

#print read_config()
    

